#include <iostream>
#include <string>
bool IsLetters( char ch) {
    if ((ch >= 'a' && ch <= 'z') ||

        (ch >= 'A' && ch <= 'Z')) {
        return true;
    }
    else {
        return false;
    }

}
using namespace std;
class Solution {
public:

    static string reverseOnlyLetters(string s) {
        int begin = 0;
        int end = s.size() - 1;
        
        while (begin < end) {
            while (begin < end && !IsLetters(s[begin])) {

                begin++;
               
            }

            while (begin < end && !IsLetters(s[end])) {

                end--;
               
            }           
                swap(s[begin++], s[end--]);                        
        }
        return s;
    }

};

int main() {
    string s = Solution::reverseOnlyLetters("7_28]");
    cout << s;
}